package com.atguigu03.field_method.field;

/**
 * ClassName: FieldTest
 * Package: com.atguigu03.field_method.field
 * Description:
 *
 * @Author 姜
 * @Create 2023/11/16 14:02
 * @Version 1.0
 */
public class FieldTest {
    public static void main(String[] args) {
        Person p1 = new Person();
        System.out.println(p1.name + p1.age);
        p1.sleep(8);
    }
}
class Person {
    // 属性
    String name;
    int age;
    char gender;

    // 方法
    public void eat() {
        String food = "红烧肘子";
        System.out.println("我喜欢吃：" + food);
    }

    public void sleep(int hour) {
        System.out.println("每天要睡" + hour + "小时");
    }
}